package com.atguigu.gmall.activity.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 仅仅为了测试Redis发布订阅 广播消息
 * @author: atguigu
 * @create: 2023-01-30 15:21
 */
@RestController
@RequestMapping("/api")
public class TestContrlller {

    @Autowired
    private RedisTemplate redisTemplate;

    @GetMapping("/sendmsg")
    public String sendMsg(String msg) {
        redisTemplate.convertAndSend("seckillpush", msg);
        return "success";
    }
}
